﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CodeManDesktopBlazor
{
    /// <summary>
    /// Interaction logic for LoginWindow.xaml
    /// </summary>
    public partial class LoginWindow : Window
    {
        public LoginWindow()
        {
            InitializeComponent();
            this.initWindowStateStartupLocation(WindowState.Normal);
        }

        private void en_Click(object sender, RoutedEventArgs e)
        {
            GData.DefaultThreadCurrentCulture = LangFlagenum.en;
            ShowMainWindows(LangFlagenum.en);
        }
        private void zh_Click(object sender, RoutedEventArgs e)
        {
            GData.DefaultThreadCurrentCulture = LangFlagenum.zh;
            ShowMainWindows(LangFlagenum.zh);
        }
        private void ShowMainWindows(LangFlagenum langFlagenum)
        {
            GData.SetCurrentCulture(langFlagenum);
            GData.SetDefaultThreadCurrentCulture(langFlagenum);

            MainWindow mainWindow = (App.Current as App).GetMainWindow();
            this.Hide();
            mainWindow.ShowDialog();
            this.Topmost = true;
            this.Show();
        }


    }
}
